package com.example.demo.DynaSQL;

import com.example.demo.beans.*;
import org.apache.ibatis.jdbc.SQL;

/**
 * Created by 黄启位 on 2022-01-21.
 */
public class NaExamProvider {
    /***
     * 插入门诊医生检验申请表
     * @param b
     * @return
     */
    public String  InsertJysq(jysqdBean b){
        return new SQL(){
            {
                INSERT_INTO("mzys_jysq");
                if(b.getJysqh()!=null){
                    VALUES("jysqh","#{jysqh}");
                }
                if(b.getYwckbm()!=null){
                    VALUES("ywckbm","#{ywckbm}");
                }
                if(b.getRyghxh()!=null){
                    VALUES("ryghxh","#{ryghxh}");
                }
                if(b.getZxks()!=null){
                    VALUES("zxks","#{zxks}");
                }
                if(b.getSfjz()!=null){
                    VALUES("sfjz","#{sfjz}");
                }
                if(b.getLczd()!=null){
                    VALUES("lczd","#{lczd}");
                }
                if(b.getSjys()!=null){
                    VALUES("sjys","#{sjys}");
                }
                if(b.getSjrq()!=null){
                    VALUES("sjrq","#{sjrq}");
                }
                if(b.getJehj()!=null){
                    VALUES("jehj","#{jehj}");
                }
                if(b.getYhhj()!=null){
                    VALUES("yhhj","#{yhhj}");
                }
                if(b.getSjhj()!=null){
                    VALUES("sjhj","#{sjhj}");
                }
                if(b.getSqsj()!=null){
                    VALUES("sqsj","#{sqsj}");
                }
                if(b.getSqys()!=null){
                    VALUES("sqys","#{sqys}");
                }
                if(b.getMzks()!=null){
                    VALUES("mzks","#{mzks}");
                }
                if(b.getSjysqz()!=null){
                    VALUES("sjysqz","#{sjysqz}");
                }
                if(b.getSjysqzsj()!=null){
                    VALUES("sjysqzsj","#{sjysqzsj}");
                }
                if(b.getKjlx()!=null){
                    VALUES("kjlx","#{kjlx}");
                }

                if(b.getKfbz()!=null){
                    VALUES("kfbz","#{kfbz}");
                }
                if(b.getKfry()!=null){
                    VALUES("kfry","#{kfry}");
                }
                if(b.getKfrq()!=null){
                    VALUES("kfrq","#{kfrq}");
                }

            }
        }.toString();
    }

    /**
     * 插入检验门诊检验申请明细表
      * @param b
     * @return
     */
    public String InsetJysqmx(jysqdmxBean b){
     return  new SQL(){
         {
             INSERT_INTO("mzys_jysqmx");
         if(b.getJysqh()!=null){
             VALUES("jysqh","#{jysqh}");
         }
             if(b.getJysqmxxh()!=null){
                 VALUES("jysqmxxh","#{jysqmxxh}");
             }
             if(b.getMxfyxmbm()!=null){
                 VALUES("mxfyxmbm","#{mxfyxmbm}");
             }
             if(b.getSl()!=null){
                 VALUES("sl","#{sl}");
             }
             if(b.getDj()!=null){
                 VALUES("dj","#{dj}");
             }
             if(b.getJe()!=null){
                 VALUES("je","#{je}");
             }
             if(b.getYhbl()!=null){
                 VALUES("yhbl","#{yhbl}");
             }
             if(b.getYhje()!=null){
                 VALUES("yhje","#{yhje}");
             }
             if(b.getSfzhfy()!=null){
                 VALUES("sfzhfy","#{sfzhfy}");
             }
             if(b.getZxks()!=null){
                 VALUES("zxks","#{zxks}");
             }
             if(b.getKskfbz()!=null){
                 VALUES("kskfbz","#{kskfbz}");
             }
             if(b.getDyxmxh()!=null){
                 VALUES("dyxmxh","#{dyxmxh}");
             }
         }
     }.toString();
    }

    /****
     * 插入门诊表病人费用表
     * @param b
     * @return
     */
    public String InsertMzbbrfy(mzbBrfyBean b){
        return  new SQL(){
            {INSERT_INTO( "mzb_brfy");
             if(b.getFbbm()!=null){
              VALUES("fbbm","#{fbbm}");
             }
                if(b.getCzybm()!=null){
                    VALUES("czybm","#{czybm}");
                }
                if(b.getYwckbm()!=null){
                    VALUES("ywckbm","#{ywckbm}");
                }
                if(b.getXlbm()!=null){
                    VALUES("xlbm","#{xlbm}");
                }
                if(b.getMxfyxmbm()!=null){
                    VALUES("mxfyxmbm","#{mxfyxmbm}");
                }
                if(b.getDlbm()!=null){
                    VALUES("dlbm","#{dlbm}");
                }
                if(b.getSfrq()!=null){
                    VALUES("sfrq","#{sfrq}");
                }
                if(b.getRybrid()!=null){
                    VALUES("rybrid","#{rybrid}");
                }

                if(b.getRyghxh()!=null){
                    VALUES(" ryghxh","#{ ryghxh}");
                }
                if(b.getBrxm()!=null){
                    VALUES("brxm","#{brxm}");
                }
                if(b.getFysl()!=null){
                    VALUES("fysl","#{fysl}");
                }
                if(b.getYtsl()!=null){
                    VALUES("ytsl","#{ytsl}");
                }
                if(b.getFydj()!=null){
                    VALUES("fydj","#{fydj}");
                }
                if(b.getFyje()!=null){
                    VALUES("fyje","#{fyje}");
                }

                if(b.getYhbl()!=null){
                    VALUES("yhbl","#{yhbl}");
                }
                if(b.getYhje()!=null){
                    VALUES("yhje","#{yhje}");
                }
                if(b.getMzys()!=null){
                    VALUES("mzys","#{mzys}");
                }
                if(b.getMzks()!=null){
                    VALUES(" mzks","#{ mzks}");
                }
                if(b.getHsks()!=null){
                    VALUES("hsks","#{hsks}");
                }
                if(b.getZxks()!=null){
                    VALUES("zxks","#{zxks}");
                }

                if(b.getYzlx()!=null){
                    VALUES("yzlx","#{yzlx}");
                }
                if(b.getYzhm()!=null){
                    VALUES("yzhm","#{yzhm}");
                }
                if(b.getYzxh()!=null){
                    VALUES("yzxh","#{yzxh}");
                }
                if(b.getBzsm()!=null){
                    VALUES("bzsm","#{bzsm}");
                }
                if(b.getSfjs()!=null){
                    VALUES("sfjs","#{sfjs}");
                }
                if(b.getMzzd()!=null){
                    VALUES("mzzd","#{mzzd}");
                }
                if(b.getSfzhfy()!=null){
                    VALUES("sfzhfy","#{sfzhfy}");
                }
                if(b.getSflx()!=null){
                    VALUES("sflx","#{sflx}");
                }
                if(b.getKskfbz()!=null){
                    VALUES("kskfbz","#{kskfbz}");
                }
                if(b.getKskfry()!=null){
                    VALUES("kskfry","#{kskfry}");
                }
                if(b.getKskfry()!=null){
                    VALUES("kskfrq","#{kskfrq}");
                }
                if(b.getJscs()!=null){
                    VALUES("jscs","#{jscs}");
                }
                if(b.getFphm()!=null){
                    VALUES("fphm","#{fphm}");
                }
                if(b.getRyjsjlid()!=null){
                    VALUES("ryjsjlid","#{ryjsjlid}");
                }


            }
        }.toString();
    }

    /**插入费用表，特别重要的一张表啊**/
    public String InsertAutoRegist(PayDetailBean bean)
    { return new SQL(){
                    {
                        INSERT_INTO("AutoRegist");
                        if(bean.getCardNo()!=null){
                            VALUES("CardNo","#{cardNo}");
                        }
                        if(bean.getCardType()!=null){
                            VALUES("CardType","#{cardType}");
                        }
                        if(bean.getPatientID()!=null){
                            VALUES("PatientID","#{patientID}");
                        }
                        if(bean.getName()!=null){
                            VALUES("Name","#{name}");
                        }
                        if(bean.getSex()!=null){
                            VALUES("Sex","#{sex}");
                        }
                        if(bean.getBirthday()!=null){
                            VALUES("Birthday","#{birthday}");
                        }
                        if(bean.getIDCardNo()!=null){
                            VALUES("IDCardNo","#{IDCardNo}");
                        }
                        if(bean.getMobile()!=null){
                            VALUES("Mobile","#{mobile}");
                        }
                        if(bean.getAddress()!=null){
                            VALUES("Address","#{address}");
                        }
                        if(bean.getPayTag()!=null){
                            VALUES("PayTag","#{payTag}");
                        }
                        if(bean.getPayAmt()!=null){
                            VALUES("PayAmt","#{payAmt}");
                        }
                        if(bean.getBankCardNo()!=null){
                            VALUES("BankCardNo","#{bankCardNo}");
                        }
                        if(bean.getBankTranNo()!=null){
                            VALUES("BankTranNo","#{bankTranNo}");
                        }
                        if(bean.getBankPNo()!=null){
                            VALUES("BankPNo","#{bankPNo}");
                        }
                        if(bean.getBankReferNo()!=null){
                            VALUES("BankReferNo","#{bankReferNo}");
                        }

                        if(bean.getBankTermid()!=null){
                            VALUES("BankTermid","#{bankTermid}");
                        }
                        if(bean.getCodeBuyerAccount()!=null){
                            VALUES("CodeBuyerAccount","#{codeBuyerAccount}");
                        }
                        if(bean.getCodeTradeOrderNo()!=null){
                            VALUES("CodeTradeOrderNo","#{codeTradeOrderNo}");
                        }
                        if(bean.getCodeTermidNo()!=null){
                            VALUES("CodeTermidNo","#{codeTermidNo}");
                        } if(bean.getPayTranDate()!=null){
                        VALUES("PayTranDate","#{payTranDate}");
                    }
                        if(bean.getPayTranTime()!=null){
                            VALUES("PayTranTime","#{payTranTime}");
                        } if(bean.getAutoTranNo()!=null){
                        VALUES("AutoTranNo","#{autoTranNo}");
                    }
                        if(bean.getUserId()!=null){
                            VALUES("UserId","#{userId}");
                        }

                        if(bean.getBzms()!=null){
                            VALUES("bzms","#{bzms}");
                        }
                        if(bean.getJsxh()!=null){
                            VALUES("jsxh","#{jsxh}");
                        }
                        if(bean.getReqtype()!=null)
                        {VALUES("reqtype","#{reqtype}");}
                        if(bean.getCzyxm()!=null){
                            VALUES("czybm","#{czybm}");
                        }
                        if(bean.getCzyxm()!=null){
                            VALUES("czyxm","#{czyxm}");
                        }
                        if(bean.getAutoOrderId()!=null){
                            VALUES("AutoOrderId","#{AutoOrderId}");
                        }
                    }
                }.toString();}

    /**插入结算记录表**/
    public String InsertGhjsjl(JsjlBean bean)
    {  return
            new SQL(){
                {INSERT_INTO("ghb_jsjl");
                    if(bean.getJsjlid()!=null){
                        VALUES("jsjlid","#{jsjlid}");
                    }
                    if(bean.getGhxh()!=null){
                        VALUES("ghxh","#{ghxh}");
                    }
                    if(bean.getJscs()!=null){
                        VALUES("jscs","#{jscs}");
                    }
                    if(bean.getCzybm()!=null){
                        VALUES("czybm","#{czybm}");
                    }
                    if(bean.getYwckbm()!=null){
                        VALUES("ywckbm","#{ywckbm}");
                    }
                    if(bean.getBrid()!=null){
                        VALUES("brid","#{brid}");
                    }
                    if(bean.getFyhj()!=null){
                        VALUES("fyhj","#{fyhj}");
                    }
                    if(bean.getYlkzf()!=null){
                        VALUES("ylkzf","#{ylkzf}");
                    }
                    if(bean.getXjzf()!=null){
                        VALUES("xjzf","#{xjzf}");
                    }
                    if(bean.getYbkzf()!=null){
                        VALUES("ybkzf","#{ybkzf}");
                    }
                    if(bean.getTbje()!=null){
                        VALUES("tbje","#{tbje}");
                    }
                    if(bean.getJsqf()!=null){
                        VALUES("jsqf","#{jsqf}");
                    }
                    if(bean.getQfbj()!=null){
                        VALUES("qfbj","#{qfbj}");
                    } if(bean.getJszt()!=null){
                    VALUES("jszt","#{jszt}");
                } if(bean.getJsrq()!=null){
                    VALUES("jsrq","#{jsrq}");
                }
                    if(bean.getCzyks()!=null){
                        VALUES("czyks","#{czyks}");
                    } if(bean.getBzms()!=null){
                    VALUES("bzms","#{ bzms}");
                }
                    if(bean.getBxjsbh()!=null){
                        VALUES("bxjsbh","#{bxjsbh}");
                    }
                    if(bean.getYbje()!=null){
                        VALUES("ybje","#{ybje}");
                    }
                    if(bean.getMbbzje()!=null){
                        VALUES("mbbzje","#{mbbzje}");
                    }
                    if(bean.getYlkyhje()!=null){
                        VALUES("ylkyhje","#{ylkyhje}");
                    }
                    if(bean.getYlkh()!=null){
                        VALUES("ylkh","#{ylkh}");
                    }
                    if(bean.getYbkzhye()!=null){
                        VALUES("ybkzhye","#{ybkzhye}");
                    }
                    if(bean.getYhje()!=null){
                        VALUES("yhje","#{yhje}");
                    }
                    if(bean.getZeyh()!=null){
                        VALUES("zeyh","#{zeyh}");
                    }
                    if(bean.getQtzf()!=null){
                        VALUES("qtzf","#{qtzf}");
                    }


                }
            }.toString();

    }

    /**
     * 保存到网络预约记录
     * @param b
     * @return
     */
    public  String InsertAutoOrderList(AutoOrderBean b){
        return new SQL(){
            {
                INSERT_INTO("AutoOrderList");
                if(b.getOrderDate()!= null){
                    VALUES("OrderDate","#{OrderDate}");
                }
                if(b.getTypeID()!= null){
                    VALUES("TypeID","#{TypeID}");
                }
                if(b.getTypeName()!= null){
                    VALUES( "TypeName","#{TypeName}");
                }
                if(b.getDeptName()!= null){
                    VALUES("DeptName","#{DeptName}");
                }
                if(b.getDeptID()!= null){
                    VALUES("DeptID","#{DeptID}");
                }
                if(b.getDoctID()!= null){
                    VALUES("DoctID","#{DoctID}");
                }
                if(b.getDoctName()!= null){
                    VALUES("DoctName","#{DoctName}");
                }
                if(b.getRankName()!= null){
                    VALUES("RankName","#{RankName}");
                }
                if(b.getRegID()!= null){
                    VALUES("RegID","#{RegID}");
                }
                if(b.getAppFee()!= null){
                    VALUES("AppFee","#{AppFee}");
                }
                if(b.getRegFee()!= null){
                    VALUES("RegFee","#{RegFee}");
                }
                if(b.getTreatFee()!= null){
                    VALUES("TreatFee","#{TreatFee}");
                }
                if(b.getOtherFee()!= null){
                    VALUES("OtherFee","#{OtherFee}");
                } if(b.getTimeRegion()!= null){
                VALUES("TimeRegion","#{TimeRegion}");
            }
                if(b.getSpecialty()!= null){
                    VALUES("Specialty","#{Specialty}");
                } if(b.getIsAvailable()!= null){
                VALUES("IsAvailable","#{IsAvailable}");
            }
                if(b.getRegWay()!= null){
                    VALUES("RegWay","#{RegWay}");
                } if(b.getIsPay()!= null){
                VALUES("IsPay","#{IsPay}");
            } if(b.getPatientID()!= null){
                VALUES("PatientID","#{PatientID}");
            } if(b.getCardNo()!= null){
                VALUES("CardNo","#{CardNo}");
            }
                if(b.getYyghid()!= null){
                    VALUES("yyghid","#{yyghid}");
                }
                if(b.getGhxh()!= null){
                    VALUES("ghxh","#{ghxh}");
                }
                if(b.getCzybm()!=null){
                    VALUES("czybm","#{czybm}");
                }
                if(b.getCzyxm()!=null){
                    VALUES("czyxm","#{czyxm}");
                }
                if(b.getBcfabm()!=null){
                    VALUES("bcfabm","#{bcfabm}");
                }
            }
        }.toString();
    }

    /**
     * 插入挂号表
     * @param b
     * @return
     */
    public  String InsertIntoGhb(BrghBean b){
        return new SQL(){
            {
                INSERT_INTO("ghb_brgh");
                if(b.getGhxh()!=null)
                {VALUES("ghxh","#{ghxh}");}
                if(b.getGhzlbm()!=null)
                {VALUES("ghzlbm","#{ghzlbm}" );}
                if(b.getGhfsbm()!=null)
                {VALUES("ghfsbm","#{ghfsbm}");}
                if(b.getFbbm()!=null)
                {VALUES("fbbm","#{fbbm}");}
                if(b.getBrid()!=null)
                {VALUES("brid","#{brid}");}
                if(b.getCzybm()!=null)
                {VALUES("czybm","#{czybm}");}
                if(b.getCzyks()!=null)
                {VALUES("czyks","#{czyks}");}
                if(b.getGhks()!=null)
                {VALUES("ghks","#{ghks}");}
                if(b.getBrnl()!=null)
                {VALUES("brnl","#{brnl}");}
                if(b.getBrnldw()!=null)
                {VALUES("brnldw","#{brnldw}");}
                if(b.getGhrq()!=null)
                {VALUES("ghrq","#{ghrq}");}
                if(b.getJzrq()!=null)
                {VALUES("jzrq","#{jzrq}");}
                if(b.getYwckbm()!=null)
                {VALUES("ywckbm","#{ywckbm}");}
                if(b.getJzys()!=null)
                {VALUES("jzys","#{jzys}");}
                if(b.getYyghid()!=null){
                    VALUES("yyghid","#{yyghid}");
                }
                if(b.getOrderId()!=null){
                    VALUES("orderId","#{orderId}");
                }
            }


        }.toString();
    }

}
